/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.camachosanchez.mechanics;

import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Rectangle;

/**
 *
 * @author ZULLY
 */
public class ContenedorBateria {
    private int posicion;
    private int x;
    private int y;
    private int alto;
    private int ancho;
    private boolean estaMontado;
    
    public ContenedorBateria(int x, int y, int ancho, int alto, int posicion, boolean estaMontado) {
        this.x = x;
        this.y = y;
        this.alto = alto;
        this.ancho = ancho;
        this.estaMontado = estaMontado;
        this.posicion = posicion;
    }

    public int getAlto() {
        return alto;
    }

    public void setAlto(int alto) {
        this.alto = alto;
    }

    public int getAncho() {
        return ancho;
    }

    public void setAncho(int ancho) {
        this.ancho = ancho;
    }

    public boolean isEstaMontado() {
        return estaMontado;
    }

    public void setEstaMontado(boolean estaMontado) {
        this.estaMontado = estaMontado;
    }

    public int getPosicion() {
        return posicion;
    }

    public void setPosicion(int posicion) {
        this.posicion = posicion;
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    public boolean estaDentro(Point p) {
//        if(p.x<x || (p.x>(x+ancho)))
        Rectangle r = new Rectangle(x, y, ancho, alto);
        return r.contains(p);
    }

    public void graficar(Graphics2D graphics) {
        graphics.setColor(Color.white);
        float dash[] = {2.0f};
        graphics.setStroke(new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, dash, 0.0f));
        graphics.fillRect(x + 5, y + 5, ancho - 10, alto - 10);
        graphics.setColor(Color.black);
        graphics.drawRect(x + 5, y + 5, ancho - 10, alto - 10);
        graphics.setStroke(new BasicStroke());
        graphics.drawLine(x + (ancho / 2) - 6, y + alto / 2, x + (ancho / 2) + 6, y + alto / 2);
        graphics.drawLine(x + ancho / 2, y + (alto / 2) - 6, x + ancho / 2, y + (alto / 2) + 6);
    }
}
